﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ctrl="clr-namespace:Waf.DotNetPad.Presentation.Controls"
                    xmlns:ae="http://icsharpcode.net/sharpdevelop/avalonedit">
    
    <Style TargetType="ctrl:CodeEditor">
        <Style.Setters>
            <Setter Property="FontFamily" Value="Consolas"/>
            <Setter Property="FontSize" Value="10pt"/>
            <Setter Property="Padding" Value="3,0,0,0"/>
            <Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
        </Style.Setters>
    </Style>
    
    <DataTemplate DataType="{x:Type ctrl:CodeCompletionDescription}">
        <StackPanel>
            <TextBlock x:Name="summaryBlock" Text="{Binding Summary}" 
                       Visibility="{Binding Summary, Converter={StaticResource StringNullEmptyToVisibilityConverter}}"/>
            <Control Height="7">
                <Control.Style>
                    <Style TargetType="Control">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Visibility, ElementName=summaryBlock}" Value="Collapsed">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Visibility, ElementName=overloadsBlock}" Value="Collapsed">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Control.Style>
            </Control>
            <TextBlock x:Name="overloadsBlock" Text="{Binding Overloads}"
                       Visibility="{Binding Overloads, Converter={StaticResource StringNullEmptyToVisibilityConverter}}"/>
        </StackPanel>
    </DataTemplate>

    <Style TargetType="ae:SearchPanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ae:SearchPanel}">
                    <Border Background="{StaticResource DarkBackground}" HorizontalAlignment="Right" VerticalAlignment="Top" Cursor="Arrow">
                        <StackPanel Orientation="Horizontal">
                            <TextBox Name="PART_searchTextBox" Width="150" Height="22" Margin="5,4,0,4" Padding="3,0"
                                     BorderThickness="0" VerticalContentAlignment="Center">
                                <TextBox.Text>
                                    <Binding Path="SearchPattern" RelativeSource="{RelativeSource TemplatedParent}" UpdateSourceTrigger="PropertyChanged">
                                        <Binding.ValidationRules>
                                            <ExceptionValidationRule />
                                        </Binding.ValidationRules>
                                    </Binding>
                                </TextBox.Text>
                            </TextBox>
                            <ae:DropDownButton Height="24" Foreground="{StaticResource DarkForeground}">
                                <ae:DropDownButton.DropDownContent>
                                    <Popup StaysOpen="False">
                                        <Border Background="{StaticResource DarkBackground}">
                                            <StackPanel Orientation="Vertical" TextElement.FontFamily="Segoe UI" Margin="0,3,5,3">
                                                <CheckBox IsChecked="{Binding MatchCase, RelativeSource={RelativeSource TemplatedParent}}" 
                                                          Content="{Binding Localization.MatchCaseText, RelativeSource={RelativeSource TemplatedParent}}" Margin="3"
                                                          Foreground="{StaticResource DarkForeground}"/>
                                                <CheckBox IsChecked="{Binding WholeWords, RelativeSource={RelativeSource TemplatedParent}}" 
                                                          Content="{Binding Localization.MatchWholeWordsText, RelativeSource={RelativeSource TemplatedParent}}" Margin="3" 
                                                          Foreground="{StaticResource DarkForeground}"/>
                                                <CheckBox IsChecked="{Binding UseRegex, RelativeSource={RelativeSource TemplatedParent}}" 
                                                          Content="{Binding Localization.UseRegexText, RelativeSource={RelativeSource TemplatedParent}}" Margin="3" 
                                                          Foreground="{StaticResource DarkForeground}"/>
                                            </StackPanel>
                                        </Border>
                                    </Popup>
                                </ae:DropDownButton.DropDownContent>
                            </ae:DropDownButton>
                            <Button Command="ae:SearchCommands.FindPrevious" Height="24" Width="24" Margin="3,3,0,3"
                                    Background="{StaticResource DarkBackground}" Foreground="{StaticResource DarkForeground}" BorderBrush="{StaticResource DarkBackground}"
                                    ToolTip="{Binding Localization.FindPreviousText, RelativeSource={RelativeSource TemplatedParent}}">
                                <Path Width="13" Height="9.3" Stretch="Fill" Fill="{StaticResource DarkForeground}"
                                      Data="F1 M 57,42L 57,34L 32.25,34L 42.25,24L 31.75,24L 17.75,38L 31.75,52L 42.25,52L 32.25,42L 57,42 Z "/>
                            </Button>
                            <Button Command="ae:SearchCommands.FindNext" Height="24" Width="24" Margin="0,3,0,3"
                                    Background="{StaticResource DarkBackground}" Foreground="{StaticResource DarkForeground}" BorderBrush="{StaticResource DarkBackground}"
                                    ToolTip="{Binding Localization.FindNextText, RelativeSource={RelativeSource TemplatedParent}}">
                                <Path Width="13" Height="9.3" Stretch="Fill" Fill="{StaticResource DarkForeground}"
                                      Data="F1 M 19,34L 19,42L 43.75,42L 33.75,52L 44.25,52L 58.25,38L 44.25,24L 33.75,24L 43.75,34L 19,34 Z "/>
                            </Button>
                            <Button Command="ae:SearchCommands.CloseSearchPanel" Height="24" Width="24" Margin="0,3,3,3"
                                    Background="{StaticResource DarkBackground}" Foreground="{StaticResource DarkForeground}" BorderBrush="{StaticResource DarkBackground}"
                                    VerticalContentAlignment="Center" HorizontalContentAlignment="Center">
                                <Path Data="M 0,0 L 8,8 M 8,0 L 0,8" Stroke="{StaticResource DarkForeground}" StrokeThickness="2" />
                            </Button>
                        </StackPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>